шпаргалки
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
760 B

2 years ago
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lang;
/**
*
* @author (C)Y.D.Zakovryashin, 14.11.2022
*/
public class DemoString {
public static void main(String[] args) {
String s = "askjfsj akfkdjfal askdfjlasj asldkjflasj 1234";
// String[] as = s.split("\\s+");
// for (String t: as) {
// System.out.println(t);
// }
System.out.println(s.replaceAll("\\p{Digit}", "*"));
String n = "2202 2202 2222 2222";
String t = n.substring(5, 14);
String x = "**** ****";
n = n.replace(t, x);
System.out.println(n);
}
}