string combine and split algorithm -
i using redis storing data, datas combinated sequences of values, sequece combined separator :
, several string values, example:
value1:value2:value3
the problem values may contain :
in them, first thought escaping :
::
in values, , combine them, , can split them solo :
.
but not perfect, because {'abc', 'aaa:', 'bbb'}
escaped {'abc', 'aaa::', 'bbb'}
, combined abc:aaa:::bbb
, it's unresolveable. stupid question, i'm stuck, how solve problem, or better suggestion ?
i instead suggest enclosing values while inserting using special identifier towards beginning , end of string each , combining them. e.g :
{'%abc%', '%aaa:%', '%bbb%'}
so whenever want split them again can split them using separator , replace prepended , appended value per convention original string.
hope helps!
Comments
Post a Comment