String.cs :  » Network-Clients » SharpSSH » Tamir » SharpSsh » java » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Network Clients » SharpSSH 
SharpSSH » Tamir » SharpSsh » java » String.cs
using System;
using TextSystem.Text;
using StrSystem.String;

namespace Tamir.SharpSsh.java{
  /// <summary>
  /// Summary description for String.
  /// </summary>
  public class String
  {
    string s;
    public String(string s)
    {
      this.s=s;
    }

    public String(object o):this(o.ToString())
    {
    }

    public String(byte[] arr):this(getString(arr))
    {
    }

    public String(byte[] arr, int offset, int len):this(getString(arr, offset, len))
    {
    }

    public static implicit operator String (string s1) 
    {
      if(s1==null) return null;
      return new String(s1);
    }

    public static implicit operator Str (String s1) 
    {
      if(s1==null) return null;
      return s1.ToString();
    }

    public static Tamir.SharpSsh.java.String operator+(Tamir.SharpSsh.java.String s1, Tamir.SharpSsh.java.String s2)
    {
      return new Tamir.SharpSsh.java.String(s1.ToString()+s2.ToString());
    }

    public byte[] getBytes()
    {
      return String.getBytes(this);
    }

    public override string ToString()
    {
      return s;
    }

    public String toLowerCase()
    {
      return this.ToString().ToLower();
    }

    public bool startsWith(string prefix)
    {
      return this.ToString().StartsWith(prefix);
    }

    public int indexOf(string sub)
    {
      return this.ToString().IndexOf(sub);
    }
    
    public int indexOf(char sub)
    {
      return this.ToString().IndexOf(sub);
    }
    
    public int indexOf(char sub, int i)
    {
      return this.ToString().IndexOf(sub, i);
    }

    public char charAt(int i)
    {
      return s[i];
    }

    public String substring(int start, int end)
    {
      int len = end - start;
      return this.ToString().Substring(start, len);
    }

    public String subString(int start, int len)
    {
      return substring(start, len);
    }

    public String substring(int len)
    {
      return this.ToString().Substring(len);
    }

    public String subString(int len)
    {
      return substring(len);
    }

    public int Length()
    {
      return this.ToString().Length;
    }
    
    public int length()
    {
      return Length();
    }

    public bool endsWith(string str)
    {
      return s.EndsWith(str);
    }

    public int lastIndexOf(string str)
    {
      return s.LastIndexOf(str);
    }

    public int lastIndexOf(char c)
    {
      return s.LastIndexOf(c);
    }

    public bool equals(object o)
    {
      return this.ToString().Equals(o.ToString());
    }

    public override bool Equals(object obj)
    {
      return this.equals (obj);
    }

    public override int GetHashCode()
    {
      return s.GetHashCode ();
    }

    public static string getString(byte[] arr)
    {
      return getString(arr, 0, arr.Length);
    }

    public static string getString(byte[] arr, int offset, int len)
    {
      return Text.Encoding.Default.GetString(arr, offset, len);
    }

    public static string getStringUTF8(byte[] arr)
    {
      return getStringUTF8(arr, 0, arr.Length);
    }

    public static string getStringUTF8(byte[] arr, int offset, int len)
    {
      return Text.Encoding.UTF8.GetString(arr, offset, len);
    }

    public static byte[] getBytes(string str)
    {
      return getBytesUTF8( str );
    }
    public static byte[] getBytesUTF8(string str)
    {
      return Text.Encoding.UTF8.GetBytes( str );
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.