Often we need to Evaluate a String Dynamically , here Classic ASP / VB Script provides a power fool method named EVAL(), Let us see how to use Eval() method in Classic ASP / VB Script.
Const MYNAME = "Deepak Kumar Madheshiya"
Const MYNAME_HI = "दीपक कुमार मद्देशिया"
Dim LanguageCode: LanguageCode = 1
<%=GetString(MYNAME, LanguageCode))
OutPut: Deepak Kumar Madheshiya
LanguageCode = 0
<%=GetString(MYNAME, LanguageCode))
OutPut: दीपक कुमार मद्देशिया
Function GetString (MyValues, LanguageCode)
If LanguageCode = "1" Then
GetString = eval(MyValues & "_HI")
Else
GetString =eval(MyValues)
End If
End Function
Const MYNAME = "Deepak Kumar Madheshiya"
Const MYNAME_HI = "दीपक कुमार मद्देशिया"
Dim LanguageCode: LanguageCode = 1
<%=GetString(MYNAME, LanguageCode))
OutPut: Deepak Kumar Madheshiya
LanguageCode = 0
<%=GetString(MYNAME, LanguageCode))
OutPut: दीपक कुमार मद्देशिया
Function GetString (MyValues, LanguageCode)
If LanguageCode = "1" Then
GetString = eval(MyValues & "_HI")
Else
GetString =eval(MyValues)
End If
End Function
No comments:
Post a Comment