Hi i have a vector of char16 containing some special characters and lowercase alphabets, is is possible to check each char if :
1.) is an alphabet? if it is then i would convert it to lowercase letter or vice versa
2.) if its a special characters or spaces (eg. ' ' or ' " ' aka apos or ',' or '-' etc. then i would leave it as it is
Below is my unfinished kernel, i before moving my character by 'n' amount, i would like to check each character if its a char and convert it to upper/lower case
__kernel void A2_T2_B(
__global int n,
__global char16* char_vec,
__global char* encrypted,
__global char* decrypted ) {
int i = get_global_id(0);
if (n>0)
{
if(any(char_vec[i]=='z')==1))
{
}
char_vec[i]+=n;
}
else if(n<0)
{
char_vec[i]-=n;
}
}
OpenCL doesn't have any built-in string handling functions if that's what you're asking. You will need to implement them yourself, or find a 3rd party library.
There isn't a general answer we can give, because the implementation will depend heavily on the encoding. For plain ASCII, you can use something like: