Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make letters and numbers together  RSS feed

 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Additional to :

What i want is to have together the 3 letters with the 4 numbers. How can i work on it ? thanks
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
want is to have together the 3 letters with the 4 numbers

Can you post an example of the results you are looking for and an explanation of how the 4 numbers relate to the 3 letters?
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Let's look at this part by part.
  .indexOf(
Returns the index of the string argument you pass in. If the string isn't found it returns -1.
  test.charAt(i)
Returns the character at the index of the argument you pass in.

So the condition is true if the character that's at index i in test is not found in the string (uppercase letters and numbers).
 
Fred Kleinschmidt
Bartender
Posts: 560
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is true if that character *is* found somewhere in str
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, yes: if the character is found.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:
want is to have together the 3 letters with the 4 numbers

Can you post an example of the results you are looking for and an explanation of how the 4 numbers relate to the 3 letters?

Example i am the user and i press AMK9000 that is acceptable . If i press A02A2121 is mistake.I want to be 7 whole line (3 letter first and after 4numbers) and to system out this result
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know about regular expressions? They might be useful for detecting Strings like: AAA1234
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!