This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
    Bookmark Topic Watch Topic
  • New Topic

seeing id string has odd / even chars  RSS feed

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi all

i can find the length of a string

String s = "mystringodd";

can someone show me how i can then see if the string conains an even number of characters

e.g String s contains 11 chars

whati want to do is see if String s is even, if not i need to append a 0 to make it even, so string s becomes this 0mystringodd

can anyone help me ou with this


many thanks
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Report post to moderator
Duplicate post ... answered the other one.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!