static void Main(string[] args) { String original = "abcde FGHIJ ABC abc DEFG "; String s1 = original.ToUpper(); String s2 = original.ToLower(); String s3 = original.Trim(); int n1 = original.IndexOf("bc"); int n2 = original.LastIndexOf("bc"); String s4 = original.Substring(3); String s5 = original.Substring(3, 5); String s6 = original.Replace('a', 'x'); String s7 = original.Replace("abc", "xy"); bool b1 = String.IsNullOrEmpty(original); bool b2 = String.IsNullOrWhiteSpace(original); String *p1 = original; Console.WriteLine("Original: -" + original + "-"); Console.WriteLine("ToUpper: -" + s1 + "-"); Console.WriteLine("ToLower: -" + s2 + "-"); Console.WriteLine("Trim :-" + s3 + "-"); Console.WriteLine("IndexOf ('bc') :" + n1); Console.WriteLine("LastIndexOf('bc') :" + n2); Console.WriteLine("substring(3) :" + s4); Console.WriteLine("substring(3,5) :" + s5); Console.WriteLine("Replace('a','x'): " + s6); Console.WriteLine("Replace('abc', 'xy'):" + s7); Console.WriteLine("IsNullOrEmpty(original): " + b1); Console.WriteLine("IsNullOrWhiteSpace(original): " + b2); Console.WriteLine("==========================================================="); }
public static unsafe void Marshal(string text, String *str, Tracker tracker) { IntPtr hglobal = InteropMarshal.StringToHGlobalAnsi(text); sbyte *textPtr = (sbyte *)hglobal.ToPointer(); sbyte *lenPtr = textPtr; while (*lenPtr != 0) { ++lenPtr; } int length = (int)(lenPtr - textPtr); str->Length = length; if (tracker.IsBigEndian) { Tracker.ByteSwap32((uint *)&str->Length); } tracker.Push((void **)&str->Data, 1, length + 1); sbyte *strValue = (sbyte *)str->Data; int c; do { *strValue = *textPtr++; c = *strValue++; }while (c != 0); tracker.Pop(); InteropMarshal.FreeHGlobal(hglobal); hglobal = IntPtr.Zero; }
public object FindIcon() { #if false SwitchBoardInterpreterData *interp = (SwitchBoardInterpreterData *)_interpreterData; SwitchBoardCellAspect * asp = interp._aspects; String *p = 0; int ix; String curState; curState = this._currentState; while (asp) { if (!wxStricmp(asp._name, curState)) { break; } asp = asp._next; } if (!asp) { return(0); } p = asp._icons[0]; if (!p || !*p) { return(0); } if (_isFlashing) { if (!p[_nextFlashingIcon]) { _nextFlashingIcon = 0; } p = &p[_nextFlashingIcon]; } if ((ix = get_pixmap_index(*p)) < 0) { return(0); } return(pixmaps[ix].pixels); #else return(0); #endif }
public static extern void ConfigSetCachePath([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *cachePath);
public static extern void EnablePlatformFileSystem([NativeTypeName("ULString")] String *baseDir);
public static unsafe KeyEvent *Create(KeyEventType type, uint modifiers, int virtualKeyCode, int nativeKeyCode, String *text, String *unmodifiedText, bool isKeypad, bool isAutoRepeat, bool isSystemKey) => Ultralight.CreateKeyEvent(type, modifiers, virtualKeyCode, nativeKeyCode, text, unmodifiedText, isKeypad, isAutoRepeat, isSystemKey);
private static unsafe void LoggerCallback(LogLevel logLevel, String *msg) => Console.WriteLine($"{logLevel.ToString()}: {msg->Read()}");
public static extern void ConfigSetUserAgent([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *agentString);
public static extern KeyEvent *CreateKeyEvent(KeyEventType type, [NativeTypeName("unsigned int")] uint modifiers, int virtualKeyCode, int nativeKeyCode, [NativeTypeName("ULString")] String *text, [NativeTypeName("ULString")] String *unmodifiedText, bool isKeypad, bool isAutoRepeat, bool isSystemKey);
public static extern void StringAssignString([NativeTypeName("ULString")] String *str, [NativeTypeName("ULString")] String *newStr);
public static extern Session *CreateSession([NativeTypeName("ULRenderer")] Renderer *renderer, bool isPersistent, [NativeTypeName("ULString")] String *name);
public static extern unsafe bool FindDevicesSimple(String *DevicePortNameList[], Int32 *DeviceCount, Int32 MaxDeviceCount, Int32 PortNameStrLen);
public static extern void SettingsSetFileSystemPath([NativeTypeName("ULSettings")] Settings *settings, [NativeTypeName("ULString")] String *path);
public static extern void EnableDefaultLogger([NativeTypeName("ULString")] String *logPath);
public static extern UIntPtr StringGetLength([NativeTypeName("ULString")] String *str);
public static extern bool StringIsEmpty([NativeTypeName("ULString")] String *str);
public static extern void ViewLoadUrl([NativeTypeName("ULView")] View *view, [NativeTypeName("ULString")] String *urlString);
public static extern void StringAssignCString([NativeTypeName("ULString")] String *str, [NativeTypeName("const char *")] sbyte *cStr);
public static extern String *ViewEvaluateScript([NativeTypeName("ULView")] View *view, [NativeTypeName("ULString")] String *jsString, [NativeTypeName("ULString *")] String **exception);
public static extern void ConfigSetFontFamilySansSerif([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *fontName);
public static extern void ConfigSetResourcePath([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *resourcePath);
public static extern void ConfigSetUserStylesheet([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *cssString);
public static extern String *CreateStringFromCopy([NativeTypeName("ULString")] String *str);
public static unsafe Session *Create(Renderer *renderer, bool isPersistent, String *name) => Ultralight.CreateSession(renderer, isPersistent, name);
public static extern void DestroyString([NativeTypeName("ULString")] String *str);
public static extern char *StringGetData([NativeTypeName("ULString")] String *str);
public static extern void SettingsSetAppName([NativeTypeName("ULSettings")] Settings *settings, [NativeTypeName("ULString")] String *name);