I am trying to see if I can remove some characters from the string that the below script creates:
$(".fileName").text()
The string that is created will be something like:
"bottom.gif (0.43KB)"
I want the string to be: “bottom.gif”
the issue:
the image name can be anything. The size of the image will also varry. The only constant that I have to work with are:
space after the image name
“(” before the file size
“)” after the file size
Any help would be great!!!
Example here
It splits the text string into an array everywhere this string ‘ (‘ occurs:
and you need only text[0] for use.
note: If the ‘ (‘ doesn’t exist it will return the whole string:
so it is safe to use it with [0] and no check if the value is null.