• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

String Separation

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

QS="PRN=583945|ITC=1050306|AMT=1.0|CRN=INR|RU=https://testadm1.baazee.com/jsp/OrderOnlineBankTransferPaymentResponse.jsp?BZENTITYID1=21|CG=Y"



The above is one String �. There is a separator �|�... The output I want is

PRN=583945

ITC=1050306

AMT=1.0

�. Etc �. Pls give some idea.

Regards,

Rodricks G.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rodricks george:
... Pls give some idea...


One idea is to check the API documentation for the String class, and see if there's a method that will split a String.
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the Scanner class in the Java API.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rodricks george:
Hi ,

QS="PRN=583945|ITC=1050306|AMT=1.0|CRN=INR|RU=https://testadm1.baazee.com/jsp/OrderOnlineBankTransferPaymentResponse.jsp?BZENTITYID1=21|CG=Y"



The above is one String �. There is a separator �|�... The output I want is

PRN=583945

ITC=1050306

AMT=1.0

�. Etc �. Pls give some idea.

Regards,

Rodricks G.



To make it simple try this

[solution deleted]

Hope this helps
[ February 13, 2008: Message edited by: Fred Rosenberger ]
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Janaki Varma, thank you, but it is not the policy of the Ranch to give answers like that, least of all on the beginners' forum.

BTW: StringTokenizer ought not to be used; it is classed as legacy code in the API, so please use Marc Weber and Petrus Peiser's suggestions.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic