Help with string manipulation function
Posted
by MusiGenesis
on Stack Overflow
See other posts from Stack Overflow
or by MusiGenesis
Published on 2010-05-06T01:23:37Z
Indexed on
2010/05/06
1:28 UTC
Read the original article
Hit count: 1008
I have a set of strings that contain within them one or more question marks delimited by a comma, a comma plus one or more spaces, or potentially both. So these strings are all possible:
BOB AND ?
BOB AND ?,?,?,?,?
BOB AND ?, ?, ? ,?
BOB AND ?,? , ?,?
?, ? ,? AND BOB
I need to replace the question marks with @P#
, so that the above samples would become:
BOB AND @P1
BOB AND @P1,@P2,@P3,@P4,@P5
BOB AND @P1,@P2,@P3,@P4
BOB AND @P1,@P2,@P3,@P4
@P1,@P2,@P3 AND BOB
What's the best way to do this without regex or Linq?
© Stack Overflow or respective owner