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/
|
|
|
|
|
2020-10-12 13:59:12 +00:00
|
|
|
package algo ;import _f "strconv";
|
2020-08-23 14:15:53 +00:00
|
|
|
|
|
|
|
// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
|
2020-10-12 13:59:12 +00:00
|
|
|
func NaturalLess (lhs ,rhs string )bool {_ff ,_a :=0,0;for _ff < len (lhs )&&_a < len (rhs ){_ad :=lhs [_ff ];_ba :=rhs [_a ];_af :=_d (_ad );_fb :=_d (_ba );switch {case _af &&!_fb :return true ;case !_af &&_fb :return false ;case !_af &&!_fb :if _ad !=_ba {return _ad < _ba ;};_ff ++;_a ++;default:_bf :=_ff +1;_df :=_a +1;for _bf < len (lhs )&&_d (lhs [_bf ]){_bf ++;};for _df < len (rhs )&&_d (rhs [_df ]){_df ++;};_g ,_ :=_f .ParseUint (lhs [_ff :_bf ],10,64);_gb ,_ :=_f .ParseUint (rhs [_ff :_df ],10,64);if _g !=_gb {return _g < _gb ;};_ff =_bf ;_a =_df ;};};return len (lhs )< len (rhs );};func _d (_fe byte )bool {return _fe >='0'&&_fe <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_dd :=make ([]byte ,len (s )*cnt );_bb :=[]byte (s );for _c :=0;_c < cnt ;_c ++{copy (_dd [_c :],_bb );};return string (_dd );};
|