java - how to change letter to number -
actually beginner in java
i want know how print program show me word letter in same time
for example
i love = 1 l0v3
winter coming = w1nt3r 1s c0m1ng
this have change (a = 4, e = 3, = 1, o = 0,)
import java.util.scaneer; public class question2 { public static void main(string[]args) { scaneer keyb = new scanner(system.in); system.out.println("enter string :"); int string letter = = 4, e = 3, = 1, o = 0;
there's method string.replaceall(string regex,string replacement) want.
example usage:
string word = "winter"; word = word.replaceall("i","1"); system.out.println(word); //outputs 'w1nter'.
keep in mind case-sensitive (so replacing doesn't replace a).
things made more efficient using better regular expressions , caching regular expression too, won't go deep you're beginner. feel free google "java cache regex".
Comments
Post a Comment