I have the following C # code that I need to convert to javascript:
static private string[] ParseSemicolon(string fullString) { if (String.IsNullOrEmpty(fullString)) return new string[] { }; if (fullString.IndexOf(';') > -1) { return fullString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(str => str.Trim()).ToArray(); } else { return new[] { fullString.Trim() }; } }
I see that javascript has a split () function, but I wanted to see if there is built-in support for other checks, or do I need to do an extra loop around the array after that to βclearβ the data?
javascript jquery string split c #
leora
source share