Commit 46fbe490 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added StrReverse implementation.

parent 9554e44e
......@@ -1187,8 +1187,25 @@ static HRESULT Global_Replace(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V
static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
WCHAR *ptr1, *ptr2, ch;
BSTR ret;
HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
hres = to_string(arg, &ret);
if(FAILED(hres))
return hres;
ptr1 = ret;
ptr2 = ret + SysStringLen(ret)-1;
while(ptr1 < ptr2) {
ch = *ptr1;
*ptr1++ = *ptr2;
*ptr2-- = ch;
}
return return_bstr(res, ret);
}
static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
......@@ -196,6 +196,15 @@ Call ok(Space(5.2) = " ", "Space(5.2) = " & Space(5.2) & """")
Call ok(Space(5.8) = " ", "Space(5.8) = " & Space(5.8) & """")
Call ok(Space(5.5) = " ", "Space(5.5) = " & Space(5.5) & """")
Sub TestStrReverse(str, ex)
Call ok(StrReverse(str) = ex, "StrReverse(" & str & ") = " & StrReverse(str))
End Sub
TestStrReverse "test", "tset"
TestStrReverse "", ""
TestStrReverse 123, "321"
if isEnglishLang then TestStrReverse true, "eurT"
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