V
V
Vitaly Rybchenko2018-01-20 12:30:51
SQL Server
Vitaly Rybchenko, 2018-01-20 12:30:51

How to replace dynamic data in a string?

Hello!
The task is to find certain tags in the string, extract information from them, get another one based on it and replace the tag with new information.
For example, a tag of this format with an ID: |img|123456|/img|
The string can be, for example, this: "Picture one |img|123456|/img|, picture two |img|654321|/img|, picture three |img|561625|/img|"
It turns out that you need to find all 3 tags, get the id from them (by which we will get the link), then replace the entire tag with the html tag ( url).
I see a solution through chatindex and substring - we determine the number of tags per line, then we start a cycle in which we get each individual id by trimming the text and replace this piece with the desired html tag.
Maybe there are some other options?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question