Trim String/Text in Flutter
input string print for Flutter: String str2 = "-hello Friend- "; print(str2.trim()); Output Print : -hello Friend- NOte: Here last space remove from string. 1.Right Method: var str1 = 'Dart'; var str2 = str1.trim(); identical(str1, str2); 2.Wrong Method '\tTest String is Fun\n'.trim(); // 'Test String is Fun'
main(List<String> args) { String str = 'http://sales.local/api/v2/paymentsss/45444/ticket/verify?token=jhvycygvjhbknm.eyJpc3MiOiJodH'; RegExp exp = new RegExp(r"((http|https)://sales.local/api/v\d+/\w.*?/\d*)"); String matches = exp.stringMatch(str); print(matches); // http://sales.local/api/v2/paymentsss/45444}