Commit 71a4a1d4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added LTrim() implementation.

parent 3ea9a170
......@@ -852,8 +852,29 @@ static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR
static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
BSTR str, conv_str = NULL;
WCHAR *ptr;
HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
if(V_VT(arg) == VT_BSTR) {
str = V_BSTR(arg);
}else {
hres = to_string(arg, &conv_str);
if(FAILED(hres))
return hres;
str = conv_str;
}
for(ptr = str; *ptr && isspaceW(*ptr); ptr++);
str = SysAllocString(ptr);
SysFreeString(conv_str);
if(!str)
return E_OUTOFMEMORY;
return return_bstr(res, str);
}
static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
......@@ -237,6 +237,18 @@ TestTrim "", ""
TestTrim 123, "123"
if isEnglishLang then TestTrim true, "True"
Sub TestLTrim(str, exstr)
Call ok(LTrim(str) = exstr, "LTrim(" & str & ") = " & LTrim(str))
End Sub
TestLTrim " test ", "test "
TestLTrim "test ", "test "
TestLTrim " test", "test"
TestLTrim "test", "test"
TestLTrim "", ""
TestLTrim 123, "123"
if isEnglishLang then TestLTrim true, "True"
Sub TestRound(val, exval, vt)
Call ok(Round(val) = exval, "Round(" & val & ") = " & Round(val))
Call ok(getVT(Round(val)) = vt, "getVT(Round(" & val & ")) = " & getVT(Round(val)))
......
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