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/
|
|
|
|
|
2022-06-27 19:44:23 +00:00
|
|
|
package algo ;import _d "strconv";func _e (_b byte )bool {return _b >='0'&&_b <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_aed :=make ([]byte ,len (s )*cnt );_ba :=[]byte (s );for _cg :=0;_cg < cnt ;_cg ++{copy (_aed [_cg :],_ba );};return string (_aed );};
|
2020-08-23 14:15:53 +00:00
|
|
|
|
|
|
|
// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
|
2022-06-27 19:44:23 +00:00
|
|
|
func NaturalLess (lhs ,rhs string )bool {_f ,_gf :=0,0;for _f < len (lhs )&&_gf < len (rhs ){_ee :=lhs [_f ];_c :=rhs [_gf ];_a :=_e (_ee );_ed :=_e (_c );switch {case _a &&!_ed :return true ;case !_a &&_ed :return false ;case !_a &&!_ed :if _ee !=_c {return _ee < _c ;};_f ++;_gf ++;default:_ag :=_f +1;_eea :=_gf +1;for _ag < len (lhs )&&_e (lhs [_ag ]){_ag ++;};for _eea < len (rhs )&&_e (rhs [_eea ]){_eea ++;};_ae ,_ :=_d .ParseUint (lhs [_f :_ag ],10,64);_ea ,_ :=_d .ParseUint (rhs [_f :_eea ],10,64);if _ae !=_ea {return _ae < _ea ;};_f =_ag ;_gf =_eea ;};};return len (lhs )< len (rhs );};
|