2020-08-23 14:15:53 +00:00
|
|
|
//
|
|
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
|
|
//
|
|
|
|
// This is a commercial product and requires a license to operate.
|
|
|
|
// A trial license can be obtained at https://unidoc.io
|
|
|
|
//
|
|
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
|
2024-11-22 00:17:48 +00:00
|
|
|
package wildcard ;func MatchSimple (pattern ,name string )bool {if pattern ==""{return name ==pattern ;};if pattern =="\u002a"{return true ;};_g :=make ([]rune ,0,len (name ));_b :=make ([]rune ,0,len (pattern ));for _ ,_a :=range name {_g =append (_g ,_a );
|
|
|
|
};for _ ,_ee :=range pattern {_b =append (_b ,_ee );};_bb :=true ;return _ef (_g ,_b ,_bb );};func _cb (_eb ,_efe []rune ,_cc int )int {for len (_efe )> 0{switch _efe [0]{default:if len (_eb )==0{return -1;};if _eb [0]!=_efe [0]{return _cb (_eb [1:],_efe ,_cc +1);
|
|
|
|
};case '?':if len (_eb )==0{return -1;};case '*':if len (_eb )==0{return -1;};_gf :=_cb (_eb ,_efe [1:],_cc );if _gf !=-1{return _cc ;}else {_gf =_cb (_eb [1:],_efe ,_cc );if _gf !=-1{return _cc ;}else {return -1;};};};_eb =_eb [1:];_efe =_efe [1:];};return _cc ;
|
|
|
|
};func Index (pattern ,name string )(_ag int ){if pattern ==""||pattern =="\u002a"{return 0;};_adb :=make ([]rune ,0,len (name ));_ge :=make ([]rune ,0,len (pattern ));for _ ,_ca :=range name {_adb =append (_adb ,_ca );};for _ ,_ea :=range pattern {_ge =append (_ge ,_ea );
|
|
|
|
};return _cb (_adb ,_ge ,0);};func Match (pattern ,name string )(_ae bool ){if pattern ==""{return name ==pattern ;};if pattern =="\u002a"{return true ;};_eea :=make ([]rune ,0,len (name ));_c :=make ([]rune ,0,len (pattern ));for _ ,_f :=range name {_eea =append (_eea ,_f );
|
|
|
|
};for _ ,_gd :=range pattern {_c =append (_c ,_gd );};_ed :=false ;return _ef (_eea ,_c ,_ed );};func _ef (_af ,_ad []rune ,_bd bool )bool {for len (_ad )> 0{switch _ad [0]{default:if len (_af )==0||_af [0]!=_ad [0]{return false ;};case '?':if len (_af )==0&&!_bd {return false ;
|
|
|
|
};case '*':return _ef (_af ,_ad [1:],_bd )||(len (_af )> 0&&_ef (_af [1:],_ad ,_bd ));};_af =_af [1:];_ad =_ad [1:];};return len (_af )==0&&len (_ad )==0;};
|