Jump to content

What's with the function Left()?

Recommended Posts

Why does the expression strHx = left(s,inStr(s,",")-1) cause the error message Invalid procedure call or argument: 'left', while the expression strHx = left(s,inStr(s,",")+1) does not? I want to parse the string s and bring back everything to the left of the first comma. Any help would be appreciated.

Link to post
Share on other sites
strHx = left(s,inStr(s,",")-1)Works fine for me.  Why not:strHx =  split(s,",")(0)though?

I think I understand what's going on here. If no comma is found in s, the Left() function would get -1 as the second argument, which may cause some problems, I guess. I'll have to Replace() the comma with nothing.Thanks for your response, Blue. I don't know why it works for you, maybe version differences. I'm not sure how to get the version number for my IIS server, but the under the Default Website Properties, on the Server Extensions tab, I see version
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...