Discussion:
Determine last character of a variable
(too old to reply)
Warren Kuhl
2009-08-26 17:41:03 UTC
Permalink
This is probably a very stupid question..

I am trying to extract a substring from a variable and am unsure how to
determine the last character...

I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.

Thanks for any help!
Warren
stephen barncard
2009-08-26 17:43:32 UTC
Permalink
put char 1 to -1 of tdata into tsubstring


-------------------------
Stephen Barncard
San Francisco
http://barncard.com
Post by Warren Kuhl
This is probably a very stupid question..
I am trying to extract a substring from a variable and am unsure how to
determine the last character...
I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.
Thanks for any help!
Warren
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
Phil Davis
2009-08-26 17:44:25 UTC
Permalink
Try "char 1 to -1 of tdata".

char -1 is the last char
char -2 is the next-to-last char
and so on.

Phil Davis
Post by Warren Kuhl
This is probably a very stupid question..
I am trying to extract a substring from a variable and am unsure how to
determine the last character...
I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.
Thanks for any help!
Warren
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
--
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net
Warren Kuhl
2009-08-26 17:46:59 UTC
Permalink
Phil/Stephen,

Thanks for your help! I never understood what the -1 meant when dealing
with characters.

Appreciate your quick responses!
Warren
Post by Phil Davis
Try "char 1 to -1 of tdata".
char -1 is the last char
char -2 is the next-to-last char
and so on.
Phil Davis
Post by Warren Kuhl
This is probably a very stupid question..
I am trying to extract a substring from a variable and am unsure how to
determine the last character...
I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.
Thanks for any help!
Warren
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
stephen barncard
2009-08-26 17:49:57 UTC
Permalink
Also good for whitespace removal in some cases...

put word 1 to -1 of whatever into tOutput

-------------------------
Stephen Barncard
San Francisco
http://barncard.com
Post by Warren Kuhl
Phil/Stephen,
Thanks for your help!  I never understood what the -1 meant when dealing
with characters.
Appreciate your quick responses!
Warren
Post by Phil Davis
Try "char 1 to -1 of tdata".
char -1 is the last char
char -2 is the next-to-last char
and so on.
Phil Davis
Post by Warren Kuhl
This is probably a very stupid question..
I am trying to extract a substring from a variable and am unsure how to
determine the last character...
I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.
Thanks for any help!
Warren
_______________________________________________
use-revolution mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-revolution
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
Phil Davis
2009-08-26 17:53:29 UTC
Permalink
In my book, Rev's "chunking" capabilities are the 8th wonder of the
modern world! Their usefulness defies description.

Phil Davis
Post by stephen barncard
Also good for whitespace removal in some cases...
put word 1 to -1 of whatever into tOutput
-------------------------
Stephen Barncard
San Francisco
http://barncard.com
Post by Warren Kuhl
Phil/Stephen,
Thanks for your help! I never understood what the -1 meant when dealing
with characters.
Appreciate your quick responses!
Warren
Post by Phil Davis
Try "char 1 to -1 of tdata".
char -1 is the last char
char -2 is the next-to-last char
and so on.
Phil Davis
Post by Warren Kuhl
This is probably a very stupid question..
I am trying to extract a substring from a variable and am unsure how to
determine the last character...
I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.
Thanks for any help!
Warren
_______________________________________________
use-revolution mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-revolution
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
_______________________________________________
use-revolution mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
http://lists.runrev.com/mailman/listinfo/use-revolution
--
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net
D***@aol.com
2009-08-26 19:43:51 UTC
Permalink
As Phil said, chunking is way cool, and might be what sets our favorite
programming languages apart from all the others. HC had it because it did not
support arrays and data structures. Chunking was an answer to that
deficiency.

You should make sure you understand that the construction you wanted must
have the form:

char starNumber to endNumber... (like char 1 to 8)

You had a start number, but then had an end character. (like char 1 to w)

Craig Newman
Post by Warren Kuhl
I tried...
put char 1 to last character of tdata into tsubstring
...but this fails.
Continue reading on narkive:
Loading...