AnNoYiNg TeXt - where from ??
#1
Scooby Regular
Thread Starter
Join Date: Jan 2005
Location: Cirencester
Posts: 890
Likes: 0
Received 0 Likes
on
0 Posts
AnNoYiNg TeXt - where from ??
anyone know where i can convert text into annoying up/lower case ??
dont want any colour or moving text, just plain text
there too much for me to rewrite...
cheers
dont want any colour or moving text, just plain text
there too much for me to rewrite...
cheers
#6
Scooby Senior
Join Date: Feb 2000
Location: West Midlands
Posts: 5,763
Likes: 0
Received 0 Likes
on
0 Posts
Originally Posted by stevencotton
s/(\w)/rand(1)>0.5?uc($1):$1/eg
purely out of interest, what does the above say in "pseudo-code" (BASIC/FORTRAN/COBOL/PASCAL/C-esque)?
Cheers,
mb
#7
Scooby Regular
Originally Posted by boomer
Steven,
purely out of interest, what does the above say in "pseudo-code" (BASIC/FORTRAN/COBOL/PASCAL/C-esque)?
Cheers,
mb
purely out of interest, what does the above say in "pseudo-code" (BASIC/FORTRAN/COBOL/PASCAL/C-esque)?
Cheers,
mb
$_ = 'some string';
s/(\w)/rand(1)>0.5?uc($1):$1/eg
Substitute all word characters (actually that includes underscores but that doesn't matter) for (if a random number between 0 and 1 is greater than 0.5 then uppercase the letter that matched, otherwise leave it as it is). Do this globally, and evaluate the substitution, because it's code instead of verbatim.
Code:
steven@jovian:~(0) % perl -e '$_ = "some string"; s/(\w)/rand(1)>0.5?uc($1):$1/eg; print "$_\n";' SOmE StriNG steven@jovian:~(0) % perl -e '$_ = "some string"; s/(\w)/rand(1)>0.5?uc($1):$1/eg; print "$_\n";' soMe STring
Trending Topics
#8
Scooby Regular
Join Date: Feb 2005
Location: Derbyshire
Posts: 12,304
Likes: 0
Received 0 Likes
on
0 Posts
Originally Posted by boomer
Steven,
purely out of interest, what does the above say in "pseudo-code" (BASIC/FORTRAN/COBOL/PASCAL/C-esque)?
Cheers,
mb
purely out of interest, what does the above say in "pseudo-code" (BASIC/FORTRAN/COBOL/PASCAL/C-esque)?
Cheers,
mb
for each character in text
if randomNumber > 0.5 then
Output = Output & UpperCase(Character)
else
Output = Ouput & LowerCase(Character)
end if
next character
It assumes your random numbers generated are between 0 and 1.
#9
Scooby Regular
Join Date: May 2000
Location: MY00,MY01,RX-8, Alfa 147 & Focus ST :-)
Posts: 10,371
Likes: 0
Received 0 Likes
on
0 Posts
Originally Posted by stevencotton
It assumes there is some text in $_ that one wants to transform:
$_ = 'some string';
s/(\w)/rand(1)>0.5?uc($1):$1/eg
Substitute all word characters (actually that includes underscores but that doesn't matter) for (if a random number between 0 and 1 is greater than 0.5 then uppercase the letter that matched, otherwise leave it as it is). Do this globally, and evaluate the substitution, because it's code instead of verbatim.
$_ = 'some string';
s/(\w)/rand(1)>0.5?uc($1):$1/eg
Substitute all word characters (actually that includes underscores but that doesn't matter) for (if a random number between 0 and 1 is greater than 0.5 then uppercase the letter that matched, otherwise leave it as it is). Do this globally, and evaluate the substitution, because it's code instead of verbatim.
Code:
steven@jovian:~(0) % perl -e '$_ = "some string"; s/(\w)/rand(1)>0.5?uc($1):$1/eg; print "$_\n";' SOmE StriNG steven@jovian:~(0) % perl -e '$_ = "some string"; s/(\w)/rand(1)>0.5?uc($1):$1/eg; print "$_\n";' soMe STring
Only joking mate
#10
Scooby Regular
Originally Posted by Chris L
Congratulations Steve - that post made you the inaugural winner of Scoobynet's 'Geek of the Week' award
Thread
Thread Starter
Forum
Replies
Last Post
Scott@ScoobySpares
Full Cars Breaking For Spares
55
05 August 2018 07:02 AM
alcazar
Computer & Technology Related
2
29 September 2015 07:18 PM