//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// TypeScript helpers (universal micro-lib.) | Author: Sergei Y.Kitaev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Manipulation with strings (static class):
class HStr
{
   static HasLength(str: string|null|undefined): boolean {
      return str!=null && str.length>0
   }
   static IsVisible(str: string|null|undefined): boolean {
      return str!=null && str.trim().length>0
   }

   static NullAsEmpty(str: string|null|undefined): string {
      return str!=null ? str : ''
   }

   static EmptyAsNull(str: string|null|undefined): string|null|undefined {
      return str=='' ? null : str
   }
   static EmptyAsUndefined(str: string|null|undefined): string|null|undefined {
      return str=='' ? undefined : str
   }

   static BlankAsNull(str: string|null|undefined): string|null|undefined {
      return str!=null && str.trim()=="" ? null : str
   }
   static BlankAsUndefined(str: string|null|undefined): string|null|undefined {
      return str!=null && str.trim()=="" ? undefined : str
   }

   static Trim(str: string|null|undefined): string|null|undefined {
      return str!=null && str.length>0 ? str.trim() : str
   }
   static TrimOrNull(str: string|null|undefined): string|null {
      str = str!=null ? str.trim() : null
      return str && str.length>0 ? str : null
   }
   static TrimOrEmpty(str: string|null|undefined): string {
      return str!=null ? str.trim() : ''
   }
} // HStr
