function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vijay NagarathinamVijay Nagarathinam 

calculate permutation combination

Hi All,

I want to implement one logic like below.

Number: 345678987656733

If the user giving the input as 898765. I want to check the value is matched with the above value or not based on the below format.

The given input length is 6, It should check 6 numbers.

For example:
Combination         Result
345678           !=    898765
456789           !=    898765
567898           !=    898765
678987           !=    898765
789876           !=    898765
898765           =    898765 (Matched) Similarly it will check the remaining combination and return the result.
venkat-Dvenkat-D
You can try String contains method to check if input matches with any continuous value in your actual number. 
String strNumber = '345678987656733';
String input = String.valueOf(input);

if(strNumber.conatins(input)){
//your logic
}