I have a jobject (ts) and I want to get the last character of it and then want to compare if it is equal to 0 or s (It is a mixture of numbers and characters). What can be the easiest way to do it?
jmethodID methodId_ts = env->GetMethodID(s_clazz,"toCharsString","()Ljava/lang/String;");
jobject ts = env->CallObjectMethod(signature,methodId_ts);
Just use ts.charAt(ts.length()-1)
:
jclass cls_String = env->GetObjectClass();
jmethodID mid_String_length = env->GetMethodID(cls_String, "length", "()I");
jmethodID mid_String_charAt = env->GetMethodID(cls_String, "charAt", "()C");
jint len = env->CallIntMethod(ts, mid_String_length);
jchar c = env->CallCharMethod(ts, mid_String_charAt, len-1);