vb.net - Replacing string at certain index of Split -


using streamreader read line line of text file. when line (i.e., 123|abc|99999||ded||789), want replace first empty area text.

so far, i've been toying with

if sline.split("|")(3) = ""     'this i'm stuck, want replace index mmm end if 

i want output this: 123|abc|99999|mmm|ded||789

you split string, modify array , rejoin recreate string:

dim sline = "123|abc|99999||ded||789" dim parts = sline.split("|") if parts(3) = ""     parts(3) = "mmm"     sline = string.join("|", parts) end if 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -