কম্পিউটার

উদাহরণ সহ জাভাতে প্যাটার্ন UNICODE_CASE ক্ষেত্র


ইউনিকোড-সচেতন কেস ফোল্ডিং সক্ষম করে।

আপনি যখন CASE_INSENSITIVE পতাকার সাথে compile() পদ্ধতিতে ফ্ল্যাগ মান হিসাবে এটি ব্যবহার করেন এবং আপনি যদি রেগুলার এক্সপ্রেশন ব্যবহার করে ইউনিকোড অক্ষর অনুসন্ধান করেন উভয় ক্ষেত্রেই ইউনিকোড অক্ষর মিলে যাবে।

উদাহরণ

import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class UNICODE_CASE_Example {
   public static void main( String args[] ) {
      String regex = "\u00de";
      //Compiling the regular expression
      Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CASE|Pattern.CASE_INSENSITIVE);
      //Retrieving the matcher object
      String str[] = {"\u00de", "\u00fe", "\u00ee", "\u00ce"};
      for (String ele : str) {
         Matcher matcher = pattern.matcher(ele);
         if(matcher.matches()) {
            System.out.println(ele+" is a match for "+regex);
         } else {
            System.out.println(ele+" is not a match for "+regex);
         }
      }
   }
}

আউটপুট

Þ is a match for Þ
þ is a match for Þ
î is not a match for Þ
Î is not a match for Þ

  1. উদাহরণ সহ জাভাতে প্যাটার্ন লিটারাল ফিল্ড

  2. উদাহরণ সহ জাভাতে DOTALL ক্ষেত্রের প্যাটার্ন

  3. উদাহরণ সহ জাভাতে প্যাটার্ন মন্তব্য ক্ষেত্র

  4. উদাহরণ সহ জাভাতে প্যাটার্ন CANON_EQ ক্ষেত্র