Guest User

Untitled

a guest
Jan 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. the browser keeps sending requests to check
  2.  
  3. (?<=^|s)p{L}
  4.  
  5. PS> $s = 'the browser keeps sending requests to check'
  6. PS> -join [regex]::Matches($s, '(?<=^|s)p{L}')
  7. tbksrtc
  8.  
  9. String str = "the browser keeps sending requests to check";
  10. Matcher m = Pattern.compile("(\S)(\S+)").matcher(str);
  11. while (m.find()) {
  12. System.out.print(m.group(1));
  13. }
  14.  
  15. public String generateInitials (String original){
  16. String[] words= original.split(" ");
  17. return retrieveInitialsOfEachWord(words);
  18. }
  19.  
  20. private String retrieveInitialsOfEachWord(String[] words){
  21. String initials = "";
  22. for(String word : words){
  23. initials += word.substring(0,1);
  24. }
  25. return initials;
  26. }
Add Comment
Please, Sign In to add comment