• 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

Java character subsitution

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone out there know if there is a function for java that basically does the same the as the php function strtr()?
For those of you that don't know what that is it takes 3 strings.
Compares each letter of the first string and based on the other two strings, substitues the appropriate character.
(i.e. first string is "cat", second string may have any number of characters, so we'll say abz54ewt, and the third string would have l32ngcpa. Therefore cat would be turned into cla.
Get what I am saying?? I know I could write this myself, but sticking with the spirit of java, there's no sense reinventing the wheel here if something exists.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ryan
I don't think it exists. May be you can start writing php java package
Regards
Maulin
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
what you are looking for is
package: org.apache.commons.lang
class: StringUtils
method: replace
You will find a lot of other useful String stuff there
Download from http://jakarta.apache.org/commons/index.html
Bye,
J.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic