vbscript: Added StrReverse implementation.
This commit is contained in:
parent
9554e44e47
commit
46fbe49069
|
@ -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)
|
static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
WCHAR *ptr1, *ptr2, ch;
|
||||||
return E_NOTIMPL;
|
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)
|
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.8) = " ", "Space(5.8) = " & Space(5.8) & """")
|
||||||
Call ok(Space(5.5) = " ", "Space(5.5) = " & Space(5.5) & """")
|
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)
|
Sub TestRound(val, exval, vt)
|
||||||
Call ok(Round(val) = exval, "Round(" & val & ") = " & Round(val))
|
Call ok(Round(val) = exval, "Round(" & val & ") = " & Round(val))
|
||||||
Call ok(getVT(Round(val)) = vt, "getVT(Round(" & val & ")) = " & getVT(Round(val)))
|
Call ok(getVT(Round(val)) = vt, "getVT(Round(" & val & ")) = " & getVT(Round(val)))
|
||||||
|
|
Loading…
Reference in New Issue