0

I am new to vb net. i am trying to process a string containing emoji but I cannot do it. my string looks like this: I want to replace with what i am doing is using string.remove and string.add but I am getting surrogate pair error. ​​

dim tStr as string =""
tStr=tStr.remove(5, 2)
tStr= tStr.insert(5,"")
sebastian
  • 1
  • 1

1 Answers1

0

The index number used by the Remove and Insert methods are zero-based (the index of the first character is 0). To get the third emoji, you need to use 4 as the index instead of 5.

dim tStr as String =""
tStr=tStr.Remove(4, 2)
tStr= tStr.Insert(4,"")
Blackwood
  • 4,504
  • 16
  • 32
  • 41