Cuts part from large string from certain character to certain character with ability to ignore cascading characters.
Meaning: We start cutting once we find CutFrom
Then after that, if we found CutFrom before and ToString, we are going to ignore it and ignore 1 ToString until we reach .
This is a big help when you read json tree-structure variables and blocks
Function CutString97(FromString, Optional CutFrom = "", Optional ToString = "", Optional ByVal StartFromChar = 1)
' Cuts from char to char with ability to ignore cascading chars
' Meaning we start cutting once we find CutFrom
' Then after that, if we found CutFrom before and ToString, we are going to ignore it and ignore 1 ToString until we reach OUR ToString.
'
Rett = ""
If CutFrom > "" Then
If InStr(StartFromChar, FromString, CutFrom) > 0 Then
StartFromChar = InStr(StartFromChar, FromString, CutFrom) + Len(CutFrom)
End If
Else
End If
Rett = Mid(FromString, StartFromChar)
If ToString > "" Then
Ignore = 0
NewCut = ""
For I = 1 To Len(Rett)
If UCase(Mid(Rett, I, Len(CutFrom))) = UCase(CutFrom) Then Ignore = Ignore + 1
If UCase(Mid(Rett, I, Len(ToString))) = UCase(ToString) Then Ignore = Ignore - 1
NewCut = NewCut & Mid(Rett, I, 1)
If Ignore = -1 Then
Rett = NewCut
Exit For
End If
Next
End If
ByeBye:
CutString97 = Rett
End Function
' Cuts from char to char with ability to ignore cascading chars
' Meaning we start cutting once we find CutFrom
' Then after that, if we found CutFrom before and ToString, we are going to ignore it and ignore 1 ToString until we reach OUR ToString.
'
Rett = ""
If CutFrom > "" Then
If InStr(StartFromChar, FromString, CutFrom) > 0 Then
StartFromChar = InStr(StartFromChar, FromString, CutFrom) + Len(CutFrom)
End If
Else
End If
Rett = Mid(FromString, StartFromChar)
If ToString > "" Then
Ignore = 0
NewCut = ""
For I = 1 To Len(Rett)
If UCase(Mid(Rett, I, Len(CutFrom))) = UCase(CutFrom) Then Ignore = Ignore + 1
If UCase(Mid(Rett, I, Len(ToString))) = UCase(ToString) Then Ignore = Ignore - 1
NewCut = NewCut & Mid(Rett, I, 1)
If Ignore = -1 Then
Rett = NewCut
Exit For
End If
Next
End If
ByeBye:
CutString97 = Rett
End Function
FromString, Optional CutFrom = "", Optional ToString = "", Optional ByVal StartFromChar = 1
Views 108
Downloads 38
CodeID
DB ID
![](/Assets/UsersPics/userpic_3M62Ihum9O.jpg)
ANmarAmdeen
626
Revisions
v1.0
Wednesday
June
5
2024
![](/Assets/img/_load903.gif)