[go: up one dir, main page]

Question: Splitting strings into words

>teksbiasa:=`Hello!`;

teksbiasa:=Hello!

>nilaiASCII:=convert(teksbiasa,bytes);

nilaiASCII:=[72,101,108,108,111,33]

>E:=nilaiASCII+~nops(nilaiASCII);

E:=[78,107,114,114,117,39]

 

Hi, how i need to modify my command so the length of each word can be detected if enter a sentence instead of 1 word ?

For example, if i entered >> `Hello! Bob`, so the length of each word is [6, 3], so what i need is

 

>teksbiasa:=`Hello! Bob`;

teksbiasa:=Hello! Bob

>nilaiASCII:=convert(teksbiasa,bytes);

nilaiASCII:=[72, 101, 108, 108, 111, 33, 32, 66, 111, 98]

and my E will be >> E:=[72+6, 101+6, 108+6, 108+6, 111+6, 33+6, 32, 66+3, 111+3, 98+3] which is >>

E:= [78, 107, 114, 114, 117, 39, 32, 69, 114, 101]

Thanks for help~=]]
Have a nice day~=]]

 

Please Wait...