简体   繁体   中英

HQL query - cutting string

Can anyone tell me - is it possible to do something like this in HQL query:

I've got a string like "xxxxxx/yyyy" and I need to separate parts from this string. I mean use string part "xxxxxx" as one pattern and use "yyyy" as the second pattern in where clause. Is it possible? I couldn't fin answer for it in google. The amount of characters in "xxxxxx" part and "yyyy" part is unknown so i need to separate it by finding character "/".

Thank in advance!

Use String.Split to split the string into a string array. Beware that it will blow up if the delimiter is missing from the string.

var myArray = "xxxxxx/yyyy".Split('/');
var left = myArray[0];
var right = myArray[1];

Then you can use left and right in the where clause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM