Re: Character symbol meaning
- From: "Rick Rothstein" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 May 2009 12:51:54 -0400
Okay, that is what the code is doing... the "^" symbol has no special meaning... any character that would be found in the original text would
work as well.
I left out the word "not" in the above description; it should have read...
"Okay, that is what the code is doing... the "^" symbol has no special
meaning... any character that would ***NOT*** be found in the
original text would work as well."
--
Rick (MVP - Excel)
"Rick Rothstein" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx> wrote in message news:OSByoNL1JHA.4468@xxxxxxxxxxxxxxxxxxxxxxx
The code is attempting to locate the location within the text assigned to the variable 'str2'. This section (in the assignment to 'lastw')...
Len(str2) - Len(.Substitute(str2, " ", > ""))
counts the number of spaces in the original text (it does this by finding the difference between the length of the original text and the text with all its spaces removed. Then the code uses this number (of spaces) in the worksheet's Substitute function to replace the last space with a "^" symbol. This code then assigns the original text with the last space changed to a "^" symbol to the 'lastw' variable. The next line then locates the "^" symbol (using the worksheet's Find function) and returns that position number to the 'lasti' variable.
Okay, that is what the code is doing... the "^" symbol has no special meaning... any character that would be found in the original text would work as well. Just so you know, the code you posted is not an efficient way to locate the last space in a text string. Here is how I would do it with a single line of code...
lasti = InStrRev(str2, " ") + 1
--
Rick (MVP - Excel)
"Liz" <Liz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:988C6999-3F55-4B8B-BD72-18E6FEAA3D96@xxxxxxxxxxxxxxxxHi -
Can someone tell me what the "^" symbol in the below variables is? Is this a
symbol for space or end of line?
lastw = .Substitute(str2, " ", "^", Len(str2) - Len(.Substitute(str2, " ",
"")))
lasti = .Find("^", lastw) + 1
Thanks,
Liz
.
- References:
- Character symbol meaning
- From: Liz
- Re: Character symbol meaning
- From: Rick Rothstein
- Character symbol meaning
- Prev by Date: RE: Save as marco
- Next by Date: Re: 2003 and 2007
- Previous by thread: Re: Character symbol meaning
- Next by thread: Re: Character symbol meaning
- Index(es):
Relevant Pages
|