小编Bry*_*can的帖子

如何在字符串中获取单词的INDEX

我试图在字符串中获取单词的INDEX,如果可能的话还要删除字符串中此单词之前的所有字符,这将使我的生活更轻松.

谁能帮助我?我在c#上这样做

c# string

5
推荐指数
1
解决办法
4万
查看次数

在将SQLParameter添加到SQLCommand后,是否可以更改它的值?

我正在尝试在数据库中为集合中的每个对象进行更新,因此我想更新SQLParameters的值,以便它将反映集合中的当前对象.

另一件事,当我使用command.Parameteres.Add(MySQLParameter)时,如果我添加相同的SQLParameter两次,它是否将一个堆叠在另一个上,或者SQLCommand是否知道它是相同的SQLParameter并覆盖其信息?

谢谢!

c# ado.net

3
推荐指数
1
解决办法
2237
查看次数

保持输入占位符始终可见

我试图在我的网站中设置所有输入的样式,当他们有一个值或有焦点时,palceholder成为输入的标题(它移动到输入的顶部)但是浏览器的默认行为隐藏了占位符,当有数据时.

我真的想远离JS解决方案.

目前的结果:

在此输入图像描述 在此输入图像描述

我的css:

input:focus::-webkit-input-placeholder {
    transform: translate(-1rem,calc(-100% - 0.8rem));
    font-size: 0.9rem !important;
    opacity: 1 !important; //this doesnt seem to keep the placeholder visible
    display:block !important; //this doesnt seem to keep the placeholder visible
}

input::-webkit-input-placeholder{
    display:block !important; //this doesnt seem to keep the placeholder 
    opacity: 1 !important;  //this doesnt seem to keep the placeholder 
  } 
Run Code Online (Sandbox Code Playgroud)

html css html5

3
推荐指数
1
解决办法
5018
查看次数

找不到本地主机 (404) iis

我的计算机上的 DNS 本地主机遇到一些问题。

当我 Visual Studio 或任何浏览器查找 localhost 时,某些指令会重定向我的所有资源管理器,包括 Visual Studio 127.0.0.1 以外的其他位置。

哪里会发生这样的事?我最近更改了主机文件以将 localhost 指向其他地方,但后来它不起作用,所以我将其切换回来,所以这不是问题。

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address …
Run Code Online (Sandbox Code Playgroud)

asp.net iis localhost visual-studio-2012

2
推荐指数
1
解决办法
2万
查看次数

如何使用PostSharp停止方法的执行?

目前,我正在尝试开发一种解决方案,该方法将检查方法是否已执行以及自上次执行以来是否经过了一段时间(鉴于该方法已经过去并且时间已过去),我想从OnEntry方法跳转到OnExit,而无需实际从方法本身执行任何代码。

有点 :

public class CacheThisMethod : OnMethodBoundaryAspect
{
            public override void OnEntry(MethodExecutionArgs args)
            {
               if (isCached( args.Method.name)
                   {
                    args.MethodExecutionTag =  getReturnValue(args.Method.name)
                    //jump to OnExit
                   }
               else
                   {
                    //continue
                   }
            }
            public override void OnExit(MethodExecutionArgs args)
            {
               args.Method.ReturnValue = args.MethodExecutionTag;


             }
}
Run Code Online (Sandbox Code Playgroud)

我该如何实现?谢谢。

c# aop postsharp

2
推荐指数
1
解决办法
562
查看次数

React 嵌套映射/forEach 不起作用

我正在开发一个 CMS 系统,其嵌套子菜单根据用户/自定义等而有所不同。

为了解决这个问题,我在反应组件中放置了一个地图函数。根据文档,这种方法仅适用于一个嵌套地图功能,但显然不适用于第二个,这是我渲染子菜单所需的,有什么想法吗?

render() {
    return (
        <div className="ui dropdown item">
            {this.state.text}
            <i className="dropdown icon"></i>
            <div className="menu">
                {multipleOptions.split(',').map(function(option, i){
                    option.split('@').map(function(subOption, i){
                        return <a className="item" key={i + "random"}>{subOption}</a>;
                    })
                })}
            </div>
        </div>
    )
}
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 reactjs

1
推荐指数
1
解决办法
2036
查看次数

当索引大于100000时,String.Substring不起作用

我想,以将其存储在NO-SQL数据库拆分一个字符串对象,其中每列的存储容量不超过64KB以上,我的字符串是220 kb的.

我所做的是将我所拥有的任何字符串分割成段.我想把它分成4个像:

int howManyBytes = System.Text.ASCIIEncoding.ASCII.GetByteCount(serializedObject);
if (howManyBytes > 64000)
{
     //divide by 4
     int whereToSplit = Convert.ToInt32(howManyBytes * 0.25);
     returnValue.MethodReturnValue = serializedObject.Substring(0, whereToSplit);
     returnValue.MethodReturnValue2 = serializedObject.Substring(whereToSplit, whereToSplit * 2);
     returnValue.MethodReturnValue3 = serializedObject.Substring(whereToSplit * 2, whereToSplit * 3);
     returnValue.MethodReturnValue4 = serializedObject.Substring(whereToSplit * 3);
}
Run Code Online (Sandbox Code Playgroud)

我想要做的时候遇到问题returnValue.MethodReturnValue3 = serializedObject.Substring(whereToSplit * 2, whereToSplit * 3),除了索引超出范围之外.当我的字符串的长度是225358并且我的whereToSplit是56340时,会发生此问题.

知道为什么会这样吗?

c# string substring

0
推荐指数
1
解决办法
88
查看次数