Exemplo n.º 1
0
        public static String CleanAsNMToken_ViaJni(
            [ExcelArgument(Name = "InputString",
                           Description = "A general string")] String aInputString
            )
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return("In Function Wizard, holding calls to Java");
            }
            if (aInputString == null || aInputString.Length == 0)
            {
                return("");
            }

            String aClassName       = "com/WDataSci/WDS/Util";
            IntPtr aClassID         = Java.FindClassID(aClassName);
            String aMethodName      = "CleanAsNMToken";
            String aSignatureString = "(Ljava/lang/String;)Ljava/lang/String;";

            List <object> cmargs = new List <object> {
                aInputString
            };
            String rv = "Err";

            unsafe {
                IntPtr aMethodID = Java.FindStaticMethodID(aClassID, aMethodName, aSignatureString);
                rv = Java.CallMethod <string>(aMethodID, true, aSignatureString, cmargs);
            }
            cmargs = null;

            return(rv);
        }
Exemplo n.º 2
0
        public static String CleanStringWithRegex_ViaJni(
            [ExcelArgument(Name = "InputString")] String aInputString,
            [ExcelArgument(Name = "RegexToFind")] String aRegexString,
            [ExcelArgument(Name = "RegexToReplaceWith")] String aReplaceWithString,
            [ExcelArgument(Name = "JVM_class")] object _aClassName,
            [ExcelArgument(Name = "JVM_method")] object _aMethodName,
            [ExcelArgument(Name = "JVM_signature")] object _aSignatureString
            )
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return("In Function Wizard, holding calls to Java");
            }
            if (aInputString == null || aInputString.Length == 0)
            {
                return("");
            }

            String aClassName = __OptionalStringValue(_aClassName, "com/WDataSci/WDS/Util");

            if (aClassName == null || aClassName.Length == 0)
            {
                return("");
            }
            String aMethodName = __OptionalStringValue(_aMethodName, "CleanAsString");

            if (aMethodName == null || aMethodName.Length == 0)
            {
                return("");
            }
            String aSignatureString = __OptionalStringValue(_aSignatureString, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");

            if (aSignatureString == null || aSignatureString.Length == 0)
            {
                return("");
            }

            List <object> cmargs = new List <object> {
                aInputString, aRegexString, aReplaceWithString
            };

            IntPtr aClassID  = Java.FindClassID(aClassName);
            IntPtr aMethodID = Java.FindStaticMethodID(aClassID, aMethodName, aSignatureString);
            String rv        = Java.CallMethod <string>(aMethodID, true, aSignatureString, cmargs);

            cmargs = null;
            return(rv);
        }
Exemplo n.º 3
0
        public static String FetchFileAsString_ViaJni(
            [ExcelArgument(Name = "FileName")] String arg1
            )
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return("In Function Wizard, holding calls to Java");
            }

            List <object> cmargs = new List <object> {
                arg1
            };

            String aClassName       = "com/WDataSci/WDS/Util";
            String aMethodName      = "FetchFileAsString";
            String aSignatureString = "(Ljava/lang/String;)Ljava/lang/String;";

            IntPtr aClassID  = Java.FindClassID(aClassName);
            IntPtr aMethodID = Java.FindStaticMethodID(aClassID, aMethodName, aSignatureString);
            String rv        = Java.CallMethod <string>(aMethodID, true, aSignatureString, cmargs);

            cmargs = null;
            return(rv);
        }