标签: word-wrap

为什么我需要一个包装类?C#

我有一个长度很长的程序,有一个类和很多方法.除了using语句之外,所有这些都必须包含在一个包含整个文件的巨大类中.这个庞大的包装类的必要性似乎毫无意义,这是在以后制作一个包含多个文件的程序时使用的吗?

    using System;
    using System.IO;
    using System.Text.RegularExpressions;
    using System.Collections.Generic;
    using System.Linq;

    public class CollectKeywordsFromLogs // why do I need this ( when it is the only class [as i just added the test class for the question])
    {

    //a class
        //constructor
        //methods

    //methods

    public static void Main()  // and why would i need to explicitly declare this public? it works either way, and a private main would be useless no?
    {}

    }
Run Code Online (Sandbox Code Playgroud)

这是我的完整档案.我编译csc file.cs然后编译file.exe.

哦,对,区分大小写.谢谢.但仍然 - >为什么我不需要使用测试类时的包装类?

c# program-entry-point class word-wrap

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

当你还需要缩进包裹的行时,如何使用正则表达式在文本中包装长行?

如何更改以下文本

The quick brown fox jumps over the lazy dog.
Run Code Online (Sandbox Code Playgroud)

The quick brown fox +
    jumps over the +
    lazy dog.
Run Code Online (Sandbox Code Playgroud)

使用正则表达式?

UPDATE1

Ruby的解决方案仍然缺失...到目前为止我遇到的一个简单的解决方案是

def textwrap text, width, indent="\n"
  return text.split("\n").collect do |line|
    line.scan( /(.{1,#{width}})(\s+|$)/ ).collect{|a|a[0]}.join  indent
  end.join("\n")
end
puts textwrap 'The quick brown fox jumps over the lazy dog.', width=19, indent=" + \n    "
# >> The quick brown fox + 
# >>     jumps over the lazy + 
# >>     dog.
Run Code Online (Sandbox Code Playgroud)

ruby python regex word-wrap

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

如何在jQuery HTML插入或换行中使用'window.location.href'?

我正在尝试将链接插入到具有id"popup"的空<a>中.该链接将在弹出框中打开当前页面(我将在稍后定义参数).我正在尝试将制作超链接所需的HTML与JS变量'window.location.href'串在一起 - 如何将它们串在一起?即如何修复它以使其工作,或将其重写为'window.location.href'作为变量的函数:

$("#popup").html('<a href=' . window.location.href . '>open popup</a>');
Run Code Online (Sandbox Code Playgroud)

jquery uri replace insert word-wrap

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

在<td> </ td>的中间创建文本并在HTML中溢出它们

这里有没有人知道如何使文本在中心位置,如果文本太长,它们会比左/右HTML单元格溢出?请参阅附件:http: //i.stack.imgur.com/pnHid.png

html css word-wrap

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

JLabel字符串包装没有空格

我使用html在JLabel中创建跨越多行的文本.但是,如果我输入一个没有空格的长字符串,它就不会转到新行,而是使底层的JScrollpane显示一个水平滚动条,并将JLabel右侧的组件推出视图区域.所以任何人都知道在JLabel中是否可以在没有空格的情况下自动换行字符串?

java swing jtextarea word-wrap jtextcomponent

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

是否有一种很好的方法来分割(可能)长字符串而不在Python中分割单词?

我想确保我只打印最多80个字符的长行,但我有一个字符串s,可以更短,更长.所以我想把它分成几行而不分裂任何单词.

长字符串示例:

s = "This is a long string that is holding more than 80 characters and thus should be split into several lines. That is if everything is working properly and nicely and all that. No mishaps no typos. No bugs. But I want the code too look good too. That's the problem!"
Run Code Online (Sandbox Code Playgroud)

我可以设计出这样做的方法,例如:

words = s.split(" ")
line = ""
for w in words:
    if len(line) + len(w) <= 80:
        line += "%s " …
Run Code Online (Sandbox Code Playgroud)

python string split cpu-word word-wrap

0
推荐指数
3
解决办法
3131
查看次数

Python C包装器,用于读取可变参数长度

我正在尝试替换MATLAB / MEX并切换到Python。我遇到了SWIG,ctypes和Cython作为可能的解决方案,并开始尝试SWIG(这似乎很简单)。

我的C函数具有形式可变的参数长度main(int argc, char *argv[])。我在网上找到了解决方案,但是与SWIG一起使用会导致很多问题。

  1. 其他方法(ctypes / Cython)更简单吗?
  2. 使用SWIG进行此任务的任何示例都将有所帮助。

python swig ctypes cython word-wrap

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

文本换行与背景img

如截图所示,我正在尝试将我的文本换行以使其围绕background-img.

显然这本身并不起作用,因此我来这里是为了寻求可能的解决方案.我有几种方法可以想到自己,例如使用绝对定位将图像放在那里,但我很确定它不会帮助我包装文本.

html css word-wrap

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

CSS - "p"标签背景不包装

这是一个简单的CSS问题,但我还没有任何线索.我有几个带有背景颜色的p标签,我的问题是背景扩展到每个标签的屏幕的100%,我只是想包装单词,创建效果作为buttoms或b​​lock.我不明白为什么p背景会达到所有宽度.

小提琴:这里的确切示例

<div class="process_wrapper_mobile">
  <div class="inter_mobile_process">
    <p>Interview</p>
  </div>
  <div class="inter_mobile_process">
    <p>Data reception</p>
  </div>
  <div class="inter_mobile_process">
    <p>Design</p>
  </div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.process_wrapper_mobile {
   position: relative;
   float: left;
   width: 100%;
   height: auto;
   background-color: #CCC;
 }

.process_wrapper_mobile .inter_mobile_process {
   position: relative;
   float: left;
   width: 100%;
   height: auto;
   margin-bottom: 3%;
}
.process_wrapper_mobile .inter_mobile_process p {
   text-align: center;
   color: #fff;
   font-size: 0.9em;
   background-color: #333;
   -webkit-border-radius: 10px;
   -moz-border-radius: 10px;
   border-radius: 10px;
   padding: 3% 5%;
}
Run Code Online (Sandbox Code Playgroud)

请检查我的小提琴.

谢谢!

css position width word-wrap centering

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

如何在div中包装图像周围的文字?

我的网页组成有问题.下一个div显示我的文本和图像框,但文本不包装图像.我怎么解决这个问题?

HTML:

#boxx {
  padding: 20px 20px 20px 20px;
  position: fixed;
  left: 30%;
  border: 2px solid black;
  font: 2em Calibri;
  width: 500px;
  height: 1000px;
}

img {
  position: fixed;
  left: 30%;
  display: block;
  margin: 7px 7px 7px 7px;
}
Run Code Online (Sandbox Code Playgroud)

CSS:

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>?????</title>
  <link rel="stylesheet" href="design.css" />
</head>

<body>
  <h2 style="text-align: center">????? ???????? ?????</h2>
  <div id="boxx">????? ???????? ????? (17 [29] ?????? 1860 — 2 [15] ????? 1904) — ?????????? ??????????, ???????????????? ?????? ???????? ??????????. ?? …
Run Code Online (Sandbox Code Playgroud)

html css text alignment word-wrap

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