Forums Register Login

How to read characters from a string ?

+Pie Number of slices to send: Send
Hi,
In my java program I accepted string from the user and now I want to calculate the length of the string, and then read characters one by one to encrypt it.
How to read the characters one by one ? Like Mid$ function in VB.
+Pie Number of slices to send: Send
To find the length of string use length() method AND THAN RUN IT IN A for loop fo charter finding perhaps folowin code willhelp:

hope it may help...
Arun
+Pie Number of slices to send: Send
Thanks Arun, I will sure try.
+Pie Number of slices to send: Send
Another approach similar to the $mid is
substr(int begpos,int endpos) in a for loop
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 23375 times.
Similar Threads
Calling correct methods
how to read character from command line and store it string
identify and replace special character
what is the limitation of getString(column name)?
Magnetic Card Swipe Reader input to Console
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:21:05.