following this thread
	
	
		
			
			
				
					
						
							
						
					
					www.b4x.com
				
			
		
	
I am using String builder along with regex to create a string and replace some regex matches with new string
i know that i can simply use string.replace but that is not the case that i aim for
simply i have a string just looks like that
" hello -) how is everything -) "
i have set the makepattern function to use string builder to remove each -) character and create an image string and replace the targeted character with it
i have used substring to remove the matched character in the regex pattern and then i have added the new image string inside the stringbuilder
but the output comes backword "-) everything is how -) hello"
what i am doing wrong ?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			replace text in label with b4xgifview
I am planning to use xclv as a chatbox  with supporting of animated gifs in it like animated smilyes ..  https://www.b4x.com/android/forum/threads/b4x-b4xgifview-cross-platform-animated-gif-view.118550/#content  i have followed this tutorial that posted previously by using regex and csbuilder...
				I am using String builder along with regex to create a string and replace some regex matches with new string
i know that i can simply use string.replace but that is not the case that i aim for
simply i have a string just looks like that
" hello -) how is everything -) "
i have set the makepattern function to use string builder to remove each -) character and create an image string and replace the targeted character with it
i have used substring to remove the matched character in the regex pattern and then i have added the new image string inside the stringbuilder
but the output comes backword "-) everything is how -) hello"
what i am doing wrong ?
			
				B4X:
			
		
		
		Sub MarkPattern(Input As String, Pattern As String, GroupNumber As Int) As String
    Dim sb As StringBuilder
    Dim lastMatchEnd As Int = 0
    Dim m As Matcher = Regex.Matcher(Pattern, Input)
    sb.Initialize
   
    Do While m.Find
        Dim currentStart As Int = m.GetStart(GroupNumber)
        Dim SmileCode As String
        Dim SmileCodeToimage As String
        SmileCode = m.Group(GroupNumber)
        SmileCodeToimage = CreateSmileyImage(0, 0, DipToCurrent(30), DipToCurrent(30), SmileCode&".gif")
        sb.Append(Input.SubString2(lastMatchEnd, currentStart) & SmileCodeToimage)
        lastMatchEnd = m.GetEnd(GroupNumber)
    Loop
    If lastMatchEnd < Input.Length Then
        sb.Append(Input.SubString(lastMatchEnd))
    End If
    Return sb.ToString
End Sub
	
			
				Last edited: