Commit a1428c78 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added LCase implementation.

parent 0708b77b
......@@ -582,8 +582,33 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V
static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
BSTR str;
HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
if(V_VT(arg) == VT_NULL) {
if(res)
V_VT(res) = VT_NULL;
return S_OK;
}
hres = to_string(arg, &str);
if(FAILED(hres))
return hres;
if(res) {
WCHAR *ptr;
for(ptr = str; *ptr; ptr++)
*ptr = tolowerW(*ptr);
V_VT(res) = VT_BSTR;
V_BSTR(res) = str;
}else {
SysFreeString(str);
}
return S_OK;
}
static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
......@@ -159,4 +159,18 @@ TestUCase 0.123, "0.123"
TestUCase Empty, ""
Call ok(getVT(UCase(Null)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null)))
Sub TestLCase(str, ex)
x = LCase(str)
Call ok(x = ex, "LCase(" & str & ") = " & x & " expected " & ex)
End Sub
TestLCase "test", "test"
TestLCase "123aBC?", "123abc?"
TestLCase "", ""
TestLCase 1, "1"
TestLCase true, "true"
TestLCase 0.123, "0.123"
TestLCase Empty, ""
Call ok(getVT(LCase(Null)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null)))
Call reportSuccess()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment