In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
In the process of development projects, we often encounter problems that need to parse the URL of forums, blogs, etc., such as: 'abc/def/jkl' or' abc/def/jkl/', gets the last'/ 'after all the characters' jkl', because the number of special characters'/'is not fixed, front-to-back forward parsing URL is a bit difficult, in fact, there is a simpler way, that is reverse parsing.
The idea of reverse parsing is very simple, because the position of the last special character'/'is uncertain, so use the reverse function to convert the last special character'/ 'into the first special character, and get all the characters before the first special character' /'.
Script1 for URL that does not end with'\'
Declare @ ExpressionToSearch varchar (max) set @ ExpressionToSearch='/eeabc/def/abc/jkl'--set @ ExpressionToSearch='eeabc/def/abc/jkl'--select reverse (@ ExpressionToSearch) select right (@ ExpressionToSearch, iif (charindex ('/', reverse (@ ExpressionToSearch), 1) = 0, len (@ ExpressionToSearch), charindex ('/', reverse (@ ExpressionToSearch), 1)-1)
Script2, if it ends with'/', take the string between the last two'/ 'characters, similar to taking' jkl' 'from the string' abc/def/jkl/''
Declare @ ExpressionToSearch varchar (max) set @ ExpressionToSearch='/eeabc/def/abc/jkl/'--set @ ExpressionToSearch='eeabc/def/abc/jkl'--select reverse (@ ExpressionToSearch) select left (StrToSearch,len (StrToSearch)-charindex ('/', reverse (StrToSearch), 1)) from (select right (@ ExpressionToSearch, iif (charindex ('/', reverse (@ ExpressionToSearch), 2) = 0, len (@ ExpressionToSearch)) Charindex ('/', reverse (@ ExpressionToSearch), 2)-1)) as T (StrToSearch)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.