Mercurial Hosting > luan
comparison src/luan/modules/StringLuan.java @ 1718:5603ee8e2a71
rename String.rep to String.repeated
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 25 Jul 2022 11:32:05 -0600 |
parents | c637a2a1023d |
children | 5c69d2e8bd75 |
comparison
equal
deleted
inserted
replaced
1717:c637a2a1023d | 1718:5603ee8e2a71 |
---|---|
71 public static String reverse(String s) throws LuanException { | 71 public static String reverse(String s) throws LuanException { |
72 Utils.checkNotNull(s); | 72 Utils.checkNotNull(s); |
73 return new StringBuilder(s).reverse().toString(); | 73 return new StringBuilder(s).reverse().toString(); |
74 } | 74 } |
75 | 75 |
76 public static String rep(String s,int n,String sep) { | 76 public static String repeated(String s,int n,String sep) { |
77 if( n < 1 ) | 77 if( n < 1 ) |
78 return ""; | 78 return ""; |
79 StringBuilder buf = new StringBuilder(s); | 79 StringBuilder buf = new StringBuilder(s); |
80 while( --n > 0 ) { | 80 while( --n > 0 ) { |
81 if( sep != null ) | 81 if( sep != null ) |