把VB翻译成C#,顶者有分!

sunxw18 2007-12-14 10:54:34
checked. the original data contain line return. we have a function (see below) which we convert the line return to "<br>". see if your side can handle it. thanks

An international financial firm seeks for a right candidate to join the company in a capacity of System Analyst or Senior Analyst Programmer in the regional office.

<b><u>Requirements:</u></b>
- Above 6 years' experience in AS/400.
- For SA post, min. 3 years experience in system analysis and design
- Holder of High Diploma or above in Computer Science or related subject.
- Good knowledge in COBOL/400 or RPG/400
- Experience in insurance / financial systems.
- Good communication in inter-personal skills

If you are interested in applying the job, please e-mail your detailed resume in <b>MS Word format</b> to <a href="mailto:alex@techsearch.com.hk"><u><font color=#004b61>alex@techsearch.com.hk</u></font></a>
- The latest and expected annual package is useful for us to search matched vacancies in the market.
- We are limited not to disclose our client's information due to our service commitments.
- Your personal data will not be disclosed to any third party prior to you consent by all means. All personal data are strictly confidential and only be used for the recruitment activities.
- We do not accept any oversea applications.
- No service fee is required for job seekers.



Function DisplayText(strString)

Const CARET = "-"

Dim strText
Dim strLine
Dim strChar
Dim intPos
Dim bStarted

strText = ""
bStarted = False

Do Until Len(strString) = 0

intPos = InStr(strString, vbCRLF)
If intPos <> 0 Then
strLine = LTrim(Left(strString, intPos - 1))
strChar = Left(strLine, 1)
If strChar = CARET Then
If Not bStarted Then
strText = strText & "<ul>"
bStarted = True
End If
strText = strText & "<li>" & Trim(Right(strLine, Len(strLine) - 1)) & "</li><br>"
ElseIf Trim(strLine) = "" Then
strText = strText & "<br>"
Else
If bStarted Then
bStarted = False
strText = strText & "</ul>" & strLine & "<br>"
Else
strText = strText & strLine & "<br>"
End If
End If
strString = Right(strString, Len(strString) - intPos - 1)
Else
strLine = LTrim(strString)
strChar = Left(strLine, 1)
strString = ""
If strChar = CARET Then
If Not bStarted Then
strText = strText & "<ul>"
bStarted = True
End If
strText = strText & "<li>" & Trim(Right(strLine, Len(strLine) - 1)) & "</li>"
Else
If bStarted Then
bStarted = False
strText = strText & "</ul>" & strLine & "<br>"
Else
strText = strText & strLine & "<br>"
End If
End If
End If
Loop

If bStarted Then
strText = strText & "</ul>"
End If

DisplayText = strText

End Function
...全文
540 73 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
73 条回复
切换为时间正序
请发表友善的回复…
发表回复
kitt03 2008-02-23
  • 打赏
  • 举报
回复
顶楼主,顶帮忙翻译者!!
hjhx__521 2007-12-29
  • 打赏
  • 举报
回复
结了吧
fei997yang 2007-12-16
  • 打赏
  • 举报
回复
帮顶
hapen_zhang 2007-12-16
  • 打赏
  • 举报
回复
帮顶~
cangwu_lee 2007-12-15
  • 打赏
  • 举报
回复
有創意
-------------------------------------
可以先编译,再反编译为C#
lgyhack 2007-12-15
  • 打赏
  • 举报
回复
顶了 看看高手们 是咋解决的
yitian130 2007-12-15
  • 打赏
  • 举报
回复
jf
chuxue1342 2007-12-15
  • 打赏
  • 举报
回复

public object DisplayText(object strString)
{

const object CARET = "-";

object strText;
object strLine;
object strChar;
object intPos;
object bStarted;

strText = "";
bStarted = false;

while (!(Strings.Len(strString) == 0)) {

intPos = Strings.InStr(strString, Constants.vbCRLF);
if (intPos != 0) {
strLine = Strings.LTrim(Strings.Left(strString, intPos - 1));
strChar = Strings.Left(strLine, 1);
if (strChar == CARET) {
if (!bStarted) {
strText = strText + " <ul> ";
bStarted = true;
}
strText = strText + " <li> " + Strings.Trim(Strings.Right(strLine, Strings.Len(strLine) - 1)) + " </li> <br> ";
}
else if (Strings.Trim(strLine) == "") {
strText = strText + " <br> ";
}
else {
if (bStarted) {
bStarted = false;
strText = strText + " </ul> " + strLine + " <br> ";
}
else {
strText = strText + strLine + " <br> ";
}
}
strString = Strings.Right(strString, Strings.Len(strString) - intPos - 1);
}
else {
strLine = Strings.LTrim(strString);
strChar = Strings.Left(strLine, 1);
strString = "";
if (strChar == CARET) {
if (!bStarted) {
strText = strText + " <ul> ";
bStarted = true;
}
strText = strText + " <li> " + Strings.Trim(Strings.Right(strLine, Strings.Len(strLine) - 1)) + " </li> ";
}
else {
if (bStarted) {
bStarted = false;
strText = strText + " </ul> " + strLine + " <br> ";
}
else {
strText = strText + strLine + " <br> ";
}
}
}
}

if (bStarted) {
strText = strText + " </ul> ";
}
return strText;


}
AccessManager 2007-12-15
  • 打赏
  • 举报
回复
DING~
wss1801 2007-12-15
  • 打赏
  • 举报
回复
顶一下来
「已注销」 2007-12-15
  • 打赏
  • 举报
回复
顶分!!!!!!!!!!!!!!!
Love_My 2007-12-15
  • 打赏
  • 举报
回复
# public object DisplayText(object strString)
# {
#
# const object CARET = "-";
#
# object strText;
# object strLine;
# object strChar;
# object intPos;
# object bStarted;
#
# strText = "";
# bStarted = false;
#
# while (!(Strings.Len(strString) == 0)) {
#
# intPos = Strings.InStr(strString, Constants.vbCRLF);
# if (intPos != 0) {
# strLine = Strings.LTrim(Strings.Left(strString, intPos - 1));
# strChar = Strings.Left(strLine, 1);
# if (strChar == CARET) {
# if (!bStarted) {
# strText = strText + " <ul> ";
# bStarted = true;
# }
# strText = strText + " <li> " + Strings.Trim(Strings.Right(strLine, Strings.Len(strLine) - 1)) + " </li> <br> ";
# }
# else if (Strings.Trim(strLine) == "") {
# strText = strText + " <br> ";
# }
# else {
# if (bStarted) {
# bStarted = false;
# strText = strText + " </ul> " + strLine + " <br> ";
# }
# else {
# strText = strText + strLine + " <br> ";
# }
# }
# strString = Strings.Right(strString, Strings.Len(strString) - intPos - 1);
# }
# else {
# strLine = Strings.LTrim(strString);
# strChar = Strings.Left(strLine, 1);
# strString = "";
# if (strChar == CARET) {
# if (!bStarted) {
# strText = strText + " <ul> ";
# bStarted = true;
# }
# strText = strText + " <li> " + Strings.Trim(Strings.Right(strLine, Strings.Len(strLine) - 1)) + " </li> ";
# }
# else {
# if (bStarted) {
# bStarted = false;
# strText = strText + " </ul> " + strLine + " <br> ";
# }
# else {
# strText = strText + strLine + " <br> ";
# }
# }
# }
# }
#
# if (bStarted) {
# strText = strText + " </ul> ";
# }
# return strText;
#
#
# }
dmarkplus 2007-12-15
  • 打赏
  • 举报
回复
转换器: http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx


public object DisplayText(object strString)
{

const object CARET = "-";

object strText;
object strLine;
object strChar;
object intPos;
object bStarted;

strText = "";
bStarted = false;

while (!(Strings.Len(strString) == 0)) {

intPos = Strings.InStr(strString, Constants.vbCRLF);
if (intPos != 0) {
strLine = Strings.LTrim(Strings.Left(strString, intPos - 1));
strChar = Strings.Left(strLine, 1);
if (strChar == CARET) {
if (!bStarted) {
strText = strText + " <ul> ";
bStarted = true;
}
strText = strText + " <li> " + Strings.Trim(Strings.Right(strLine, Strings.Len(strLine) - 1)) + " </li> <br> ";
}
else if (Strings.Trim(strLine) == "") {
strText = strText + " <br> ";
}
else {
if (bStarted) {
bStarted = false;
strText = strText + " </ul> " + strLine + " <br> ";
}
else {
strText = strText + strLine + " <br> ";
}
}
strString = Strings.Right(strString, Strings.Len(strString) - intPos - 1);
}
else {
strLine = Strings.LTrim(strString);
strChar = Strings.Left(strLine, 1);
strString = "";
if (strChar == CARET) {
if (!bStarted) {
strText = strText + " <ul> ";
bStarted = true;
}
strText = strText + " <li> " + Strings.Trim(Strings.Right(strLine, Strings.Len(strLine) - 1)) + " </li> ";
}
else {
if (bStarted) {
bStarted = false;
strText = strText + " </ul> " + strLine + " <br> ";
}
else {
strText = strText + strLine + " <br> ";
}
}
}
}

if (bStarted) {
strText = strText + " </ul> ";
}
return strText;

}
kbryant 2007-12-15
  • 打赏
  • 举报
回复
up
搬运工865 2007-12-15
  • 打赏
  • 举报
回复
顶者有分!
rellylove 2007-12-15
  • 打赏
  • 举报
回复
顶,JF
rellylove 2007-12-15
  • 打赏
  • 举报
回复
顶,JF
huming_h 2007-12-14
  • 打赏
  • 举报
回复
jimsun723 2007-12-14
  • 打赏
  • 举报
回复
hoho,mark
accpbl0330 2007-12-14
  • 打赏
  • 举报
回复
mark
加载更多回复(52)

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧