public static int PrintFormatted(string format, PhpArray args) { string formattedString = PhpStrings.Format(format, args); ScriptContext.CurrentContext.Output.Write(formattedString); return(formattedString.Length); }
public static int PrintFormatted(string format, params object[] args) { string formattedString = PhpStrings.FormatInternal(format, args); ScriptContext.CurrentContext.Output.Write(formattedString); return(formattedString.Length); }
private static int SubStringCount(string haystack, string needle, getEncoding encodingGetter) { string uhaystack = ObjectToString(haystack, encodingGetter); string uneedle = ObjectToString(needle, encodingGetter); if (uhaystack == null || uneedle == null) { return(0); } return(PhpStrings.SubstringCount(uhaystack, uneedle)); }
private static string ArgToString(object var) { string s = var as string; if (s == null) { if (var is int) { s = PhpStrings.ChrUnicode((int)var); } } return(s); }
private static Value _strtolower(FlowController flow, Value[] arguments) { Debug.Assert(arguments.Length == 1); stringConverter.SetContext(flow); var stringValue = stringConverter.EvaluateToString(arguments[0]); if (stringValue == null) { return(flow.OutSet.AnyStringValue); } return(flow.OutSet.CreateString(PhpStrings.ToLower(stringValue.Value))); }
private static Value _htmlentities(FlowController flow, Value[] arguments) { Debug.Assert(arguments.Length > 0); if (arguments.Length > 1) { // TODO: Implement precisely return(flow.OutSet.AnyStringValue); } stringConverter.SetContext(flow); var stringValue = stringConverter.EvaluateToString(arguments[0]); if (stringValue == null) { return(flow.OutSet.AnyStringValue); } return(flow.OutSet.CreateString(PhpStrings.EncodeHtmlEntities(stringValue.Value))); }