Source language: Translate to:

Request: additional feature to SubStr action

Post your suggestions for future versions of NeoBook

Moderator: Neosoft Support

Request: additional feature to SubStr action

Postby dpayer » Tue Jul 17, 2012 7:29 am

I find I am doing the following very often:

Parsing a large string

Get a portion of one of the lines that were parsed from that larger string starting at a delimiter.

So when I use the SubStr action, I need to determine the length of that parsed string before I can start at position [X] and get all characters between that point and the end of the substring.

Would it be possible to have the SubStr action have the option to get ALL the remaining portion of a string from the point you start?

Something like:

Code: Select all
SubStr "[mystring]" "5" "END" "[mystring]"


If this already exists, I have missed it. I know I could put in some very long number beyond what I 'expect' the string to be but that invites a problem.

Thanks for listening.

David P.
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Wrangler » Tue Jul 17, 2012 9:10 am

Couldn't you use strlen to determine the length of the string first? Then the 'end' would be the length of the string.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1506
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby dpayer » Tue Jul 17, 2012 9:44 am

Wrangler wrote:Couldn't you use strlen to determine the length of the string first? Then the 'end' would be the length of the string.


Yes, I admit I could. So there is a way to do what I want with a couple extra steps. Since I do alot with strings, it is one extra step each time.

Note: this is not what I would consider a problem. It is a feature request. If it fits on that (huge) list of desired enhancements somewhere and seems feasible to Dave, I'd vote for it!

8)

David
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Wrangler » Tue Jul 17, 2012 9:51 am

I do a lot of string manipulation also. This WOULD be a nice extra feature to have in this action. My vote is for it. In the meantime, I just call it as a function.

It would be very useful when parsing html, which has always been a bear. Then it would save a lot of 'extra' actions.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1506
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby dec » Tue Jul 17, 2012 9:54 am

Hello,

If I can say something, David, think that others environment like Delphi, for example, put the same basic string routines: pos, len, sub, copy, etc. that NeoBook. Of course, via plugins, you can get certain useful string routines additions, and, also you can use many of this string routines on a NeoBook function, for example.

And this is the "normal way", better said, normally you (not only in NeoBook, also in others environments) can use, reuse and multi-use the basic routines in order to compound your more specific functions, who use the basic routines. In my honest opinion (in normal circumstances) you no need to worry about if this basic routines: pos, len, sub, etc., need to be called one or more times.

Of course you know a good practice is, for example, to use the "len" routine only one time (when possible) saving the result in a variable that later we can continue using instead of calling the "len" routine again. But out of this cases, you no need to worry to prepare, for example, a "MyCustomStringFunction" function that use the basic string routines in order to get the desired results. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Postby Neosoft Support » Tue Jul 17, 2012 10:35 am

You can overstate the length of the string and SubStr will stop when it reaches the end. For example:

SubStr "[mystring]" "5" "10000" "[mystring]"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby dpayer » Tue Jul 17, 2012 4:55 pm

Neosoft Support wrote:You can overstate the length of the string and SubStr will stop when it reaches the end. For example:

SubStr "[mystring]" "5" "10000" "[mystring]"


Thanks for the suggestion!

David P
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby reinier maliepaard » Wed Jul 18, 2012 11:13 am

Hello David,

You can also use the VBScript MID function. A quick test: insert the follwing code between the <head></head> of your html page and view the page in Internet Explorer:

<script type="text/vbscript">

txt="This is a beautiful day!"
document.write(Mid(txt,11))

</script>

Regards,
Reinier
reinier maliepaard
 
Posts: 30
Joined: Sat Jan 17, 2009 2:53 pm


Return to NeoBook Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest