In material table one of the column has to be trim..for example input is ramesh-123-india,the output should be come as only "india"....how to do this
Consider looking into the split()
. JavaScript docs
You can pass in a string pattern that it searches for to split it up.
1) You can make use of split
here
const str = "ramesh-123-india"; const result = str.split("-")[2]; console.log(result);
2) You can also use regex /\w+$/
here as:
const str = "ramesh-123-india"; const result = str.match(/\w+$/)[0]; console.log(result);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.