Android Question HAVING TROUBLE USING MidExtract

Intelemarketing

Active Member
Licensed User
Longtime User
Firstly, I have been quiet for some time now as I have been spending months in hospital with my wife's kidney transplant.

I am trying reserect an app I have been working on, but as the app uses FTP, and STRING FUNCTIONS, the existing code does not work anymore. (Similar to my experience with VB.NET when it was first released and kept changing (I simply had to give up).

I am still not quite sure if the FTP (.NET) will work, but now my problem is using MIDEXTRACT

I have a value -33.10187444 and what I need is the first 5 digits in the decimal section of the value ie, I want to get the value 10187

I understand if the value was -33.10187444+ (By adding a + sign to the end of the value) I can get the value .10187444 by doing a call to MidExtract as follows

Extracting Decimal part Of value:
MyValueDecimalPart = MidExtract(MyValue , ".", "+")

This works well if that's what I need

I am trying to replicate the MID Function (from VB6), which allowed me to set a starting point (anywhere in a string) and a number of characters to work with. (Without having to create and work with TAG points in the string)

MidExtract has had me scrtatching my head for hours trying to achieve this.

I previously had used String Functions to achieve this

This is such a basic requirement and I am guessing its looking me in the face but I'm not seeing how to do it

Thanks for your guidance
 

Intelemarketing

Active Member
Licensed User
Longtime User
Thanks so much guys
I later found the same as your suggestion Erel

JohnC created a subroutine called MID giving the same functionality as the MID Command in VB6 (Thanks to you also JohnC)


Using MID (like VB6):
Sub Mid(Text As String, Start As Int, Length As Int) As String
    Return Text.SubString2(Start-1,(Start + Length) -1)
End Sub

[B]Called by ...[/B]

MyOriginalString = "-33.10194459"
I = MyOriginalString.IndexOf(".")

MyExtractedString = Mid(MyOriginalString , I+1, 5)

[B]Gives me the Value[/B] 10194

Thanks to all !
 
Upvote 0
Top