Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] IndexOf and SubString, like in C#

Author
Message
Lucifer
18
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 7th Oct 2009 01:23 Edited at: 10th Oct 2009 15:20
Hi everyone,

I wrote these two very simple functions so i could handle strings like i do in C#, i find it to be much simpler and easier to work with than the commands in DBPro when i want to load a file and work with it's contents.

IndexOf(String, Char) will return an integer that has the position of the char value in the string.

SubString(String1, startpos, endpos) This function will return a string whose start position and end position of String1 is defined with startpos and endpos. ( However, as it is now, when you seperate it by using the IndexOf at first to get a seperator, you have to deduct 1 from the substring's endpos you want to get returned that's in front of the seperator. Seems to work, but i find a bug i'll post a fix )

Here's a code file with the functions and an example of how to use them.


..So yeah, i know these are very simple and not at all hard to code for yourself, but i thought i could share them since i already wrote them

-

Here's a modified IndexOf function, it get's the x y and z from a set of coordinates.


Login to post a reply

Server time is: 2024-05-05 04:36:41
Your offset time is: 2024-05-05 04:36:41