mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-27 13:48:54 +08:00
17 lines
1.3 KiB
Go
17 lines
1.3 KiB
Go
//
|
|
// 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/
|
|
|
|
package algo ;import _d "strconv";func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_ae :=make ([]byte ,len (s )*cnt );_ffb :=[]byte (s );for _gf :=0;_gf < cnt ;_gf ++{copy (_ae [_gf :],_ffb );};return string (_ae );};
|
|
|
|
// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
|
|
func NaturalLess (lhs ,rhs string )bool {_gd ,_ac :=0,0;for _gd < len (lhs )&&_ac < len (rhs ){_f :=lhs [_gd ];_fa :=rhs [_ac ];_e :=_c (_f );_ff :=_c (_fa );switch {case _e &&!_ff :return true ;case !_e &&_ff :return false ;case !_e &&!_ff :if _f !=_fa {return _f < _fa ;
|
|
};_gd ++;_ac ++;default:_b :=_gd +1;_bd :=_ac +1;for _b < len (lhs )&&_c (lhs [_b ]){_b ++;};for _bd < len (rhs )&&_c (rhs [_bd ]){_bd ++;};_ca ,_ :=_d .ParseUint (lhs [_gd :_b ],10,64);_bdf ,_ :=_d .ParseUint (rhs [_gd :_bd ],10,64);if _ca !=_bdf {return _ca < _bdf ;
|
|
};_gd =_b ;_ac =_bd ;};};return len (lhs )< len (rhs );};func _c (_g byte )bool {return _g >='0'&&_g <='9'}; |